{% extends "WebMainSiteBundle:Web:layout.html.twig" %}
{% set title = "全部课程" %}
{% block title %}
    {{ title }}
{% endblock %}
{% block myCss %}
{% endblock %}
{% block myJs %}
    <script>
        $(".conditions").on("change",".cond", function () {
            var urlParams = $("#conditionForm").serialize();
//            var val = $(this).val();
//            var urlName = $(this).attr("id");
//            var url = document.location.href;
            location.href = "{{ path("WebCourseList") }}?" + urlParams;
        })
    </script>
{% endblock %}
{% block page_header %}
    <div class="page-header">
        <div class="container">
            <div class="row">
                <div class="col-md-7">
                    <h1 class="yahei">{{ title }}</h1>
                </div>
                <div class="col-md-5">
                    <ol class="breadcrumb pull-right">
                        <li><a href="{{ path("WebIndex") }}">主页</a></li>
                        <li class="active">{{ title }}</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block main %}
{#{{ dump(rootCourseCategory) }}#}
{#{{ dump(jsonCourseCategory) }}#}
{#{{ dump(app.request) }}#}
    <section class="content content-light  videos-list videos-list-grid">
        <div class="container sub_cat_box">
            {#<div class="list-view-change text-right">#}
                {#<a href="videos-grid.htm" class="active"><i class="fa fa-th-large"></i> Grid view</a>#}
                {#<a href="videos-list.htm"><i class="fa fa-th-list"></i> List view</a>#}
                {#&#123;&#35;<hr/>&#35;&#125;#}
            {#</div>#}
            {#{{ dump(allCategory) }}#}
            <form id="conditionForm">
                <input type="hidden" name="page" value="{{ curPage ? curPage : 0 }}">
                <div class="row conditions">
                    <div class="col-md-2">
                        <span class="form-control btn btn-orange">条件筛选：</span>
                    </div>
                    <div class="col-md-2">
                        <select class="form-control cond" name="cat">
                            <option {% if app.request.get("cat") == 0 %} selected="selected" {% endif %} value="0">分类筛选</option>
                            {% for c in allCategory %}
                                <option {% if app.request.get("cat") == c.id %} selected="selected" {% endif %} value="{{ c.id }}">{{ c.name }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="col-md-2">
                        <select class="form-control cond" name="hot">
                            <option {% if app.request.get("hot") == 0 %} selected="selected" {% endif %} value="0">热度排序</option>
                            <option {% if app.request.get("hot") == 1 %} selected="selected" {% endif %} value="1">最热课程</option>
                        </select>
                    </div>
                    {#<div class="col-md-2">#}
                        {#<select class="form-control cond" name="lesson">#}
                            {#<option {% if app.request.get("lesson") == 0 %} selected="selected" {% endif %} value="0">课程数排序</option>#}
                            {#<option {% if app.request.get("lesson") == 1 %} selected="selected" {% endif %} value="1">课程最多</option>#}
                        {#</select>#}
                    {#</div>#}
                    <div class="col-md-2">
                        <select class="form-control cond" name="addTime">
                            <option {% if app.request.get("addTime") == 0 %} selected="selected" {% endif %} value="0">时间排序</option>
                            <option {% if app.request.get("addTime") == 1 %} selected="selected" {% endif %} value="1">时间倒序</option>
                            <option {% if app.request.get("addTime") == 2 %} selected="selected" {% endif %} value="2">时间正序</option>
                        </select>
                    </div>
                </div>

            </form>
            <hr />
            <div class="row">
                {#{{ dump(courses) }}#}
                {#{% set line = ["<hr/>","","",""] %}#}
                {#{% set i = 0 %}#}
    {% for i in 1..12 %}
        {% for course in courses %}
            {#{% set i = i + 1 %}#}
            {#{% if i == 4 %}<hr/>{% set i = 0 %}{% endif %}#}
            <article class="col-md-4 video-item">
                <a href="{{ path("WebCourseIndex" , { uniqueId : course.Course_uniqueId }) }}"
                   class="video-prev video-prev-small"
                   style="background-image: url({{ asset(course.Course_picCover) }});background-size: cover;background-position: center"></a>
                <h3 class="video-title"><a href="{{ path("WebCourseIndex" , { uniqueId : course.Course_uniqueId }) }}">{{ course.Course_title }}</a></h3>
                <div class="row video-params">
                    <div class="col-md-7">
                        讲师: <b>{{ course.Teacher_name ? course.Teacher_name : "佚名" }}</b>
                    </div>
                    <div class="col-md-5 text-right">
                        <b>{{ course.CourseCollect_who }}</b> <a href="#"><i class="fa fa-user"></i></a>
                    </div>
                </div>
                <div class="row video-params">
                    <div class="col-md-7">
                        更新: <b>{{ course.Course_updateTime|date("m.d") }}</b>
                    </div>
                    <div class="col-md-5 text-right">
                        {#<b>{{ course.CourseLikes_who }}</b> <a href="#"><i class="fa fa-heart"></i></a>#}
                        <b>{{ course.Course_hit }}</b> <a href="#"><i class="fa fa-eye"></i></a>
                    </div>
                </div>
            </article>
        {% endfor %}
    {% endfor %}
            </div>

            <!-- Pagination -->
            {{ pageCourse|raw }}
        </div>
    </section>

{% endblock %}